package leetcode.editor.cn.q0xx

class Q26 {
    fun removeDuplicates(nums: IntArray): Int {
        if (nums.isEmpty()) return 0
        var i = 0
        for (n in nums) {
            if (n != nums[i]) {
                i++
                nums[i] = n
            }
        }
        return i + 1
    }
}